using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SmartLink.Domain;

namespace SmartLink.Infrastructure.Cache
{
    public class DictionryCache
    {

        public static bool  SetDicCache(string categoryValue, List<SYS_Dictionary> dics)
        {
            string setStr = JsonEx.SerializeObject(dics);
            return RedisRepository.RedisManager.GetInstance().HashSet(RedisRepository.RedisKeyPre.Dictonary, categoryValue, setStr);
        }


        public static IList<SYS_Dictionary> GetDicCache(string categoryValue)
        {
            string dicStr = RedisRepository.RedisManager.GetInstance().HashGet(RedisRepository.RedisKeyPre.Dictonary, categoryValue);
            return string.IsNullOrEmpty(dicStr) ? null : JsonEx.DeserializeObject<IList<SYS_Dictionary>>(dicStr);
        }

    }
}
